package com.example.security.controller;


import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.TableFieldInfo;
import com.example.security.entity.YxDocent;
import com.example.security.service.IYxDocentService;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 讲师表 前端控制器
 * </p>
 *
 * @author liyp
 * @since 2020-01-08
 */
@RestController
@RequestMapping("/yx-docent")
public class YxDocentController {

    @Autowired
    IYxDocentService iYxDocentService;


    @PostMapping("")
    @ResponseBody
    public YxDocent add(@ApiParam("课程实体") @RequestBody YxDocent yxDocent){
        boolean result = iYxDocentService.save(yxDocent);
        YxDocent yxDocent1 = iYxDocentService.getOne(new QueryWrapper().eq(true,"mobile",yxDocent.getMobile()));
        return yxDocent1;
    }

    @PutMapping("")
    @ResponseBody
    public YxDocent update(){
        YxDocent yxDocent = new YxDocent();
        yxDocent.setId("string");
        yxDocent.setName(null);
        yxDocent.setIdNo("123456");
        yxDocent.setMobile("15637169627");
        iYxDocentService.updateById(yxDocent);
        YxDocent yxDocent1 = iYxDocentService.getOne(new QueryWrapper().eq(true,"mobile",yxDocent.getMobile()));
        return yxDocent1;
    }

}
